package com.iims.project.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.iims.common.core.domain.BaseEntity;
import com.iims.common.core.domain.BussinessEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * @TableName cmis_project
 */
@ApiModel("项目")
@TableName(value = "cmis_project")
@Data
@BussinessEntity
public class CmisProject extends BaseEntity {
    /**
     * 项目id
     */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty("项目Id")
    private Long proId;

    /**
     * 正式合同Id
     */
    @ApiModelProperty(value = "正式合同Id,项目隶属于某合同", required = true)
    @Positive(message = "正式合同Id必须有效 >0")
    private Long contractId;

    /**
     * 项目编号
     */
    @ApiModelProperty("项目编号，自生成")
    private String proCode;

    /**
     * 项目属性：合同项目/研发项目/内部订单项目
     */
    @ApiModelProperty(value = "项目属性，值来源于字典business_project_proAttr", required = true)
    @NotBlank(message = "项目属性不能为空")
    private Integer proAttr;

    @ApiModelProperty(value = "项目类型，值来源于字典business_project_proType", required = true)
    @NotBlank(message = "项目类别不能为空")
    private Integer proType;

    /**
     * 项目名称
     */
    @ApiModelProperty(value = "项目名称", required = true)
    @NotBlank(message = "项目名称不能为空，max=255个字符")
    @Size(max = 255, message = "项目名称不能大于255个字符")
    private String proName;

    /**
     * 项目状态 字典
     */
    @ApiModelProperty(value = "项目状态，值来源于字典business_project_status")
    private Integer proStatus;

    /**
     * 责任部门
     */
    @ApiModelProperty(value = "责任部门", required = true)
    @Positive(message = "责任部门必须有效 >0")
    private Integer deptCharge;

    /**
     * 责任人
     */
    @ApiModelProperty(value = "责任人", required = true)
    @NotBlank(message = "责任人不能为空")
    private String userCharge;

    /**
     * 立项时间
     */
    @ApiModelProperty(value = "立项时间|yyyy-MM-dd", required = true)
    @NotNull(message = "立项时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date establishDate;

    /**
     * 要求交期
     */
    @ApiModelProperty(value = "要求交期|yyyy-MM-dd", required = true)
    @NotNull(message = "要求交期时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date deliveryDate;

    /**
     * 计划完成时间
     */
    @ApiModelProperty(value = "计划交期|yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date planCompleteDate;

    /**
     * 实际完成时间
     */
    @ApiModelProperty(value = "实际完成时间|yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date reallyCompleteTime;

    /**
     * ERP订单号
     */
    @ApiModelProperty(value = "ERP订单号")
    private String erpNo;

    //VO
    @ApiModelProperty("责任人(中文)")
    @TableField(exist = false)
    private String userChargeCN;

    @ApiModelProperty("责任部门(中文)")
    @TableField(exist = false)
    private String deptChargeCN;
}